package com.wh.swagger_validator.pojo;

import com.wh.swagger_validator.group.Login;
import com.wh.swagger_validator.group.Register;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;

/**
 * @Auther: HuiEr
 * @Date: 2020/2/24 20:23
 * @Description
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
public class User {

    /*@NotNull(message = "id不能为空")
    @ApiModelProperty(value = "用户id")
    private int id;*/

    @NotNull(message = "用户名不能为空",groups = {Login.class, Register.class})
    @Length(message = "用户名长度未在6到15长度范围内",min = 6,max = 15,groups = {Login.class,Register.class})
    @ApiModelProperty(value = "用户名")
    private String username;

    @NotNull(message = "密码不能为空",groups = {Login.class,Register.class})
    @Length(message = "密码的长度不在6到15范围内",min = 6,max = 15,groups = {Login.class,Register.class})
    @ApiModelProperty(value = "密码")
    private String password;

    @Email(message = "不是邮箱地址",groups = Register.class)
    @ApiModelProperty("用户邮箱")
    private String mail;
}
